var barOption=function(data,head){
	/*console.log(JSON.stringify(data[0].data.length))
	console.log(JSON.stringify(data[1].data.length))
	console.log(JSON.stringify(data[1].data))*/
//	console.log(JSON.stringify(data))
/*	var name = data.name;
	var aggType = data.aggType;
	var dimensionData = data.data;
	var type = data[aggType];
	var xValue=[];
	var yValue =[];
	dimensionData.sort(compare("Name"));
	if (dimensionData) {
		for ( var i = 0; i < dimensionData.length; i++) {
			var temp = dimensionData[i];
			xValue.push(temp.Name);
			yValue.push(temp[aggType]);
		}
	}else{
		xValue.push(name);
		yValue.push(data[aggType]);
		if (!data[aggType]) {
			yValue = [];
		}
	}*/
	var xValue = [];
	for ( var i = 0; i < data.length; i++) {
		var is = data[i].isSort;
		if ((null != is && is=="true") || (i==data.length-1 && xValue.length == 0)) {
			var dimensionData = data[i].data;
			for ( var j = 0; j < dimensionData.length; j++) {
				var temp = dimensionData[j];
				xValue.push(temp.Name);
			}
		}
		
	}
	var nameData = [];

	var seriesData = [];
	for ( var i = 0; i < data.length; i++) {
		var aggType = data[i].aggType;
		var dimensionData = data[i].data;
		var cdId = data[i].cdId;
		nameData.push(data[i].name);
		if (dimensionData) {
//			dimensionData.sort(compare("Name"));
			var yValue = [];
		/*	for ( var j = 0; j < dimensionData.length; j++) {
				var temp = dimensionData[j];
				yValue.push(temp[aggType]);
			}*/
			for ( var j = 0; j < xValue.length; j++) {
				for ( var k = 0; k < dimensionData.length; k++) {
					var temp = dimensionData[k];
					if (temp.Name == xValue[j]) {
						yValue.push(temp[cdId]);
						//取y轴最大值与最小值
						if (i==0 && j==0) {
							min = temp[cdId];
							max = temp[cdId];
						}else{
							if (min > temp[cdId]) {
								min = temp[cdId];
							}
							if (max < temp[cdId]) {
								max = temp[cdId];
							}
						}
						
						break;
					}
				}
				
			}
			
			
			var s = {
						name:data[i].name,
						type:'bar',
						data:yValue
					};
			seriesData.push(s);
		}
		
	}
	

	
	return {
	    title : {
	        text: head,				//主标题
//	        subtext: subhead		//副标题
	        x:'center'
	    },
	    tooltip : {
	    	show:false,
	        trigger: 'axis'
	    },
	    legend: {
	    	show:true,
	    	x:'left',
	    	y:'bottom',
	        data:nameData	//x轴统计字段名称
	    },
	    toolbox: {
	        show : false,
	        feature : {
	            mark : {show: false},
	            dataView : {show: false, readOnly: false},
	            magicType : {show: false, type: ['line', 'bar']},
	            restore : {show: false},
	            saveAsImage : {show: true}
	        }
	    },
	    calculable : false,
	    xAxis : [
	        {
	            type : 'category',
	            axisLabel: {
	            	rotate: -45
	            	},
	            data : xValue				//x轴的值
	        }
	    ],
	    yAxis : [
	        {
	            type : 'value',
	            min : 'dataMin',
	            max : 'dataMax'
	        }
	    ],
	    series : seriesData,
	              noDataLoadingOption:{
	              	text :"暂无数据",
	              	    effect : 'bubble',
	              	    effectOption:{
	              	    	backgroundColor:"#fff",
	              	    	effect:{
	              	    		n:0
	              	    	}
	              	    },
	              	    textStyle : {
	              	        fontSize : 20
	              	    }
	              }
	              
	              
	              
	};  
}
